using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace dotIRC
{
    public partial class IrcColorChooser : UserControl
    {
        Label[] _labels;

        public IrcColorChooser()
        {
            InitializeComponent();
            _labels = new Label[]{
                color0,color1,color2,color3,color4,color5,color6,color7,color8,
                color9,color10,color11,color12,color13,color14,color15
            };
            int i=0;
            foreach (Label clrlbl in _labels)
            {
                clrlbl.Tag = i;
                clrlbl.Click += new EventHandler(clrlbl_Click);
                i++;
            }
        }

        void clrlbl_Click(object sender, EventArgs e)
        {
            Label label = (Label)sender;
            _color = (IrcColor)((int)(label.Tag));
            label.BorderStyle = BorderStyle.FixedSingle;
        }

        IrcColor _color;

        public IrcColor SelectedColor
        {
            get { return _color; }
            set { _color = value; }
        }
    }
}
